import * as path from 'path'

import { DatabaseTypes, DbmService } from '../../src'
import { FileHelper } from '../../src/lib/utils/fileHelper'

const databaseTypes: DatabaseTypes[] = [
	DatabaseTypes.db2,
	DatabaseTypes.mariadb,
	DatabaseTypes.mssql,
	DatabaseTypes.mysql,
	DatabaseTypes.oracle,
	DatabaseTypes.postgresql,
	DatabaseTypes.sqlite,
]

function GenerateMarkdown() {
	databaseTypes.forEach((db) => {
		const modelPath = path.join(__dirname, db, `${db}-model.json`)
		const markdownPath = path.join(__dirname, db, 'tables')
		DbmService.toMarkdown(FileHelper.readJsonFileSync(modelPath), markdownPath, true)
	})
}

GenerateMarkdown()
